package com.guli.statisticservice.controller;


import com.guli.commonutils.R;
import com.guli.statisticservice.client.UcentClient;
import com.guli.statisticservice.service.StatisticsDailyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-04-21
 */
@RestController
@RequestMapping("/edustatistics/statistics")
@CrossOrigin
public class StatisticsDailyController {
    @Resource
    private StatisticsDailyService statisticsDailyService;
    //根据日期统计数据注册人数
    @PostMapping("{day}")
    public R createStatisticsByDate(@PathVariable String day) {
        statisticsDailyService.createStatisticsByDay(day);
        return R.ok();
    }

    @GetMapping("showchart/{begin}/{end}/{type}")
    public R showChart(@PathVariable("begin") String begin,@PathVariable("end") String
            end,@PathVariable("type") String type){
        Map<String, Object> map = statisticsDailyService.getChartData(begin, end, type);
        return R.ok().data(map);
    }

}

